//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class COFile {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public COFile(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(COFile obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_COFile(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public COFile() {
    this(nelmiscJNI.new_COFile__SWIG_0(), true);
  }

  public COFile(String path, boolean append, boolean text, boolean useTempFile) {
    this(nelmiscJNI.new_COFile__SWIG_1(path, append, text, useTempFile), true);
  }

  public COFile(String path, boolean append, boolean text) {
    this(nelmiscJNI.new_COFile__SWIG_2(path, append, text), true);
  }

  public COFile(String path, boolean append) {
    this(nelmiscJNI.new_COFile__SWIG_3(path, append), true);
  }

  public COFile(String path) {
    this(nelmiscJNI.new_COFile__SWIG_4(path), true);
  }

  public boolean open(String path, boolean append, boolean text, boolean useTempFile) {
    return nelmiscJNI.COFile_open__SWIG_0(swigCPtr, this, path, append, text, useTempFile);
  }

  public boolean open(String path, boolean append, boolean text) {
    return nelmiscJNI.COFile_open__SWIG_1(swigCPtr, this, path, append, text);
  }

  public boolean open(String path, boolean append) {
    return nelmiscJNI.COFile_open__SWIG_2(swigCPtr, this, path, append);
  }

  public boolean open(String path) {
    return nelmiscJNI.COFile_open__SWIG_3(swigCPtr, this, path);
  }

  public boolean isOpen() {
    return nelmiscJNI.COFile_isOpen(swigCPtr, this);
  }

  public void close() {
    nelmiscJNI.COFile_close(swigCPtr, this);
  }

  public void flush() {
    nelmiscJNI.COFile_flush(swigCPtr, this);
  }

  public boolean seek(int offset, IStream.TSeekOrigin origin) {
    return nelmiscJNI.COFile_seek(swigCPtr, this, offset, origin.swigValue());
  }

  public int getPos() {
    return nelmiscJNI.COFile_getPos(swigCPtr, this);
  }

  public String getStreamName() {
    return nelmiscJNI.COFile_getStreamName(swigCPtr, this);
  }

  public void serialBuffer(SWIGTYPE_p_unsigned_char buf, long len) {
    nelmiscJNI.COFile_serialBuffer(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(buf), len);
  }

}
